<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计算属性的setter</title>
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
	</head>
	<body>
		<div id="app">
			 <p>{{fullName}}</p>
		</div>
		<script>
			var vm = new Vue({
				el:'#app',
				data:{
					firstName:'aa',
					lastName:'bb'
				},
				computed:{
					fullName:{
						get:function(){
							return this.firstName+':'+this.lastName
						},
						set:function(newVal){
							var names = newVal.split(' ');
							this.firstName=names[0];
							this.lastName=names[names.length-1];
						}
					}
				}
			})
		</script>
	</body>
</html>
